/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.wins.vertx.entity;

import io.vertx.core.json.JsonObject;

/**
 * Converter for {@link io.wins.vertx.entity.CustomerAddress}.
 *
 * NOTE: This class has been automatically generated from the {@link io.wins.vertx.entity.CustomerAddress} original class using Vert.x codegen.
 */
public class CustomerAddressConverter {

  public static void fromJson(final JsonObject json, final CustomerAddress obj) {
    if (json.getValue("areaCode") instanceof String) {
      obj.setAreaCode((String)json.getValue("areaCode"));
    }
    if (json.getValue("areaName") instanceof String) {
      obj.setAreaName((String)json.getValue("areaName"));
    }
    if (json.getValue("isDefault") instanceof Boolean) {
      obj.setDefault((Boolean)json.getValue("isDefault"));
    }
    if (json.getValue("detail") instanceof String) {
      obj.setDetail((String)json.getValue("detail"));
    }
    if (json.getValue("parentId") instanceof String) {
      obj.setParentId((String)json.getValue("parentId"));
    }
    if (json.getValue("phone") instanceof String) {
      obj.setPhone((String)json.getValue("phone"));
    }
    if (json.getValue("postcode") instanceof String) {
      obj.setPostcode((String)json.getValue("postcode"));
    }
    if (json.getValue("receiver") instanceof String) {
      obj.setReceiver((String)json.getValue("receiver"));
    }
  }

  public static void toJson(final CustomerAddress obj, final JsonObject json) {
    if (obj.getAreaCode() != null) {
      json.put("areaCode", obj.getAreaCode());
    }
    if (obj.getAreaName() != null) {
      json.put("areaName", obj.getAreaName());
    }
    json.put("isDefault", obj.isDefault());
    if (obj.getDetail() != null) {
      json.put("detail", obj.getDetail());
    }
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getParentId() != null) {
      json.put("parentId", obj.getParentId());
    }
    if (obj.getPhone() != null) {
      json.put("phone", obj.getPhone());
    }
    if (obj.getPostcode() != null) {
      json.put("postcode", obj.getPostcode());
    }
    if (obj.getReceiver() != null) {
      json.put("receiver", obj.getReceiver());
    }
  }
}